package ModelLayer;
import java.util.ArrayList;


public class DVDList
{
    
    private ArrayList<DVD> dvdlist;
    
    public DVDList()
    {
        
        dvdlist=new ArrayList<DVD>();
    }
    public void addDVD(DVD newDVD)
    {dvdlist.add(newDVD);}
    public DVD findDVD(int no)
    {boolean found=false;
     int index=0;
     while (index<dvdlist.size()&&!found)
     {DVD d=dvdlist.get(index);
         if (d.getNo()==no)
         {found=true;}
         else {index++;}
        }
     if(found){return dvdlist.get(index);}
     else {return null;}}
 
    public void removeDVD(int no)
    {boolean found=false;
     int index=0;
     while (index<dvdlist.size()&&!found)
     {DVD d=dvdlist.get(index);
         if (d.getNo()==no)
         {found=true;}
         else {index++;}
        }
     if(found){DVD d=dvdlist.get(index); dvdlist.remove(d);}}
     
    public ArrayList getList()
    {return dvdlist;}
    

}
